fix(codex): keep background memory out of chats - #5468
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces runtime behavior that filters memory_consolidation thread notifications from chat, preventing them from appearing in the UI. While well-tested, this is a meaningful change to notification visibility that warrants human review. You can customize Macroscope's approvability policy. Learn more. |
8f751f0 to
dc5b475
Compare
|
#5219 routes registered This PR specifically recognizes |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78cec14. Configure here.
Dismissing prior approval to re-evaluate 48b0235

What Changed
Codex memory consolidation runs in background threads, but T3 treated their notifications as part of the active chat. Internal messages and tool activity could therefore appear in the user's conversation.
T3 now recognizes both current and legacy memory-thread metadata and filters notifications from those threads before provider events are emitted. Tracking is removed when the internal thread closes.
Why
This keeps background memory maintenance isolated without hiding normal commentary, review or compaction work, or user-created subagents.
Fixes #4683
Validation
vp test run apps/server/src/provider/Layers/CodexSessionRuntime.test.tsvp lint apps/server/src/provider/Layers/CodexSessionRuntime.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.tsvp run --filter t3 typecheckvp fmt --check apps/server/src/provider/Layers/CodexSessionRuntime.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.tsChecklist
Built with gpt-5.6-sol using the Codex harness in T3 Code.
Note
Filter memory consolidation thread notifications out of Codex session events
makeMemoryConsolidationNotificationFilterinCodexSessionRuntime.tsthat tracks threads withthreadSource === 'memory_consolidation'(or legacy{ subAgent: 'memory_consolidation' }source) and returns a predicate to suppress their notifications.makeCodexSessionRuntimeso thatCodexSessionRuntime.eventsnever emits notifications for memory consolidation threads; suppression ends afterthread/closedis received.CodexSessionRuntime.eventswill no longer see any events from memory consolidation sub-agent threads.Macroscope summarized c512b45.
Note
Medium Risk
Changes Codex notification routing in the session runtime, which affects what every client sees on
events; scope is narrow and well-tested but touches collab/stop paths alongside filtering.Overview
Codex memory consolidation background threads were leaking into the user chat via
CodexSessionRuntimeprovider events. This PR addsmakeMemoryConsolidationNotificationFilter, which registers threads fromthreadSource: "memory_consolidation"or legacysource.subAgent: "memory_consolidation", suppresses all subsequent notifications for those thread IDs, and clears tracking onthread/closed.handleRawNotificationnow drops suppressed notifications before collab/parent emission, so internal deltas and warnings never reach clients. Review, compaction, and user-spawned subagents are unchanged.Tests cover filter behavior (including post-close forget) and extend the collab Stop integration scenario so memory consolidation threads still get
turn/interruptwithout surfacing as chat events.Reviewed by Cursor Bugbot for commit c512b45. Bugbot is set up for automated code reviews on this repo. Configure here.